package com.topfinance.payment.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.topfinance.frame.dao.HibernateEntityDao;
import com.topfinance.frame.exception.AppException;
import com.topfinance.payment.ebo.TC2c1BizMatchEbo;
import com.topfinance.payment.service.ITC2C1BizMatchMgr;

/**
 * 该类自动实现了dao的一般方法，如add, remove, update
 * 在service中出现的大部分情况下是在向后台提交数据前的处理(如校验)及获取后台数据后的处理等
 * @author
 *
 */

public class TC2C1BizMatchMgrImpl extends HibernateEntityDao<TC2c1BizMatchEbo> implements ITC2C1BizMatchMgr {

	private static final Log log = LogFactory.getLog(TC2C1BizMatchMgrImpl.class);

	//获得一二代二代业务报文匹配
	public List<TC2c1BizMatchEbo> getAllBizMatch(String msg,String tpcode,String clscode) throws AppException{
		String hql = " from TC2c1BizMatchEbo m " ;
		String where = "";
		if (msg != null)
			where += " and m.msgCode ='" + msg + "'";
		if (tpcode != null) 
			where += " and m.tpCode = '" + tpcode + "'";
		if (clscode != null) 
			where += " and m.clasCode = '" + clscode + "'";
		List<Object> paramList = new ArrayList<Object>();
		if (isNotBlank(where)) {
			where = " where " + where.substring(4);
		}
		hql = hql + where;
		return find(hql,paramList.toArray());		
	}
}
